package com.twu.biblioteca;

/**
 * Created by MDH on 23/07/2014.
 */
public class MovieImpl implements Movie {
    private boolean checkedIn;
    private int rating; // -1: unrated 1-10: rating
    private String director;
    private String title;
    private String year;

    public MovieImpl(String movieTitle, String movieDirector, String movieYear, int movieRating, boolean isCheckedInOut) {
        title = movieTitle;
        year = movieYear;
        director = movieDirector;
        rating = movieRating;
        checkedIn = isCheckedInOut;
    }

    @Override
    public String getMovieTitle() {
        return title;
    }

    @Override
    public String getMovieYear() {
        return year;
    }

    @Override
    public String getMovieDirector() {
        return director;
    }

    @Override
    public int getMovieRating() {
        return rating;
    }

    @Override
    public boolean isCheckedIn() {
        return checkedIn;
    }

    @Override
    public void toPrint() {
        System.out.printf("%-40s %-20s %-20s %-10s\n", getMovieTitle(), getMovieYear(), getMovieDirector(), getMovieRating());
    }

    @Override
    public String checkOutMovie() {
        if(isCheckedIn() == true){
            checkedIn = false;
            return "Thank you! Enjoy the movie";
        }
        return "That movie is not available.";
    }

    @Override
    public String checkInMovie() {
        if(isCheckedIn() == false){
            checkedIn = true;
            return "Thank you for returning your movie";
        }
        return "This book is not a valid movie to return";
    }
}
